@extends('admin.layout')
@section('content')
    <div class="content-wrapper" style="min-height: 916px;">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>地址管理
                <small>列表</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 后台</a></li>
                <li><a href="#">地址管理</a></li>
                <li class="active">列表</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">地址</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body">
                            <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                                <div class="row">
                                    <form action="{{url('admin/address/index')}}" method="post">
                                        {{csrf_field()}}
                                        <div class="col-sm-6">
                                            <div class="dataTables_length" id="example1_length">
                                                <label>显示 <select name="num" aria-controls="example1"
                                                                  class="form-control input">
                                                        @if(!empty($request['num']))
                                                            <option value="{{$request['num']}}"
                                                                    style="display: none;">{{$request['num']}}</option>
                                                        @endif
                                                        <option value="10">10</option>
                                                        <option value="25">25</option>
                                                        <option value="50">50</option>
                                                        <option value="100">100</option>
                                                    </select> 条</label>
                                            </div>
                                        </div>
                                        <div class="input-group input-group col-md-6">
                                            @if(!empty($request['keyword']))
                                                <input type="text" name="keyword" class="form-control"
                                                       value="{{$request['keyword']}}" placeholder="搜索手机号..."/>
                                            @else
                                                <input type="text" name="keyword" class="form-control" value=""
                                                       placeholder="搜索手机号..."/>
                                            @endif
                                            <span class="input-group-btn"> <button type="submit"
                                                                                   class="btn btn-info btn-flat">Go!</button> </span>
                                        </div>

                                    </form>
                                </div>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <table class="table table-bordered table-hover dataTable" id="example2"
                                               role="grid" aria-describedby="example2_info">
                                            <thead>
                                            <tr role="row">
                                                <th class="sorting_asc" tabindex="0" aria-controls="example2"
                                                    rowspan="1" colspan="1" aria-sort="ascending"
                                                    aria-label="Rendering engine: activate to sort column descending">ID
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Platform(s): activate to sort column ascending">收货人
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Platform(s): activate to sort column ascending">性别
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Platform(s): activate to sort column ascending">地址
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Platform(s): activate to sort column ascending">详细地址
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Platform(s): activate to sort column ascending">手机号
                                                </th>
                                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1"
                                                    colspan="1"
                                                    aria-label="Engine version: activate to sort column ascending">操作
                                                </th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @foreach($data as $address)
                                                <tr role="row" class="odd">
                                                    <td class="sorting_1">{{$address -> id}}</td>
                                                    <td>{{$address -> getname}}</td>
                                                    <td>
                                                        @if($address -> sex == 1)
                                                            男
                                                        @elseif($address -> sex == 0)
                                                            女
                                                        @else
                                                            不明
                                                        @endif
                                                    </td>
                                                    <td>{{$address -> address}}</td>
                                                    <td>{{$address -> position}}</td>
                                                    <td>{{$address -> phone}}</td>
                                                    <td>
                                                        <a href="{{asset('admin/address/delete')}}/{{$address->id}}">删除</a>
                                                    </td>
                                                </tr>
                                            @endforeach
                                            </tbody>
                                        </table>
                                        {!! $data->appends($request)->render() !!}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>

@endsection